﻿using System;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using MouseExtender.Logic;
using MouseExtender.Logic.Entities;
using MouseExtender.Logic.Helpers;
using MouseExtender.Logic.Managers;

namespace MouseExtender.Controls.UserControls
{
	/// <summary>
	/// Interaction logic for UrlsUC.xaml
	/// </summary>
	public partial class UrlsUC : UserControl
	{
		public UrlsUC()
		{
			InitializeComponent();
		}

		public void AddNewUrl()
		{
			string url = txtUrl.Text;
			string toolTip = txtUrlTooltip.Text;

			MainWindow.AddWebUrlItem(url, toolTip);
		}

		private void UserControl_Loaded(object sender, RoutedEventArgs e)
		{
			txtUrl.Focus();
			txtUrl.Text = Constants.Http;
			txtUrlTooltip.Text = string.Empty;
			txtUrl.CaretIndex = txtUrl.Text.Length;
		}
	}
}